<?php

session_start();

require_once 'boot.php';
require 'deia_controller.php';
require 'deia_model.php';

if(file_exists(ROOT . DS . APP_DIR . DS . CONTROLLER_DIR . DS . FILE . CONTROLLER . ".php")){
    require FILE . CONTROLLER . ".php";

    if(file_exists(ROOT . DS . APP_DIR . DS . MODEL_DIR . DS . FILE . MODEL . ".php")){
        require FILE . MODEL . ".php";
    }

    $className = ucfirst(FILE) . "_Controller";
}else{
    require 'index_controller.php';

    if(file_exists(ROOT . DS . APP_DIR . DS . MODEL_DIR . DS . "index_model.php")){
        require 'index_model.php';
    }

    $className = "Index_Controller";    
}

$page = new $className;
$page->renderPage();